<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Title</title>
</head>
<body>

</body>
<script>
	Function.prototype.myApply = function(context){
		if (typeof context === "number" || typeof context === "string" || typeof context === "boolean") {
			context = new Object(context);
		}else if(context === undefined || context === null){
			context = window;
		}
		// this即是fn
		const propName = Math.random().toString(36).slice(2);
		context[propName] = this;
		// context[propName]([100,200,300].join(","))
		// context[propName](100,200,300)
		// console.log("context[propName]([100,200,300].join(","))")
		// console.log("context[propName]("+[100,200,300].join(",")+")");// context[propName](100,200,300)
		eval("context[propName]("+[100,200,300].join(",")+")");
		delete context[propName];
		
		
	}
	function fn(a,b,c){
		console.log(a,b,c,this);// 100 200 300 [1,2,3]
	}
	// fn.myApply([1,2,3],[100,200,300])
	fn.myApply(null,[100,200,300])
</script>
</html>